<template>
	<view>
		<view class="allmyfeedback" v-for="(item,index) in listdata">
			
			<view class="" v-for="(it,ind) in item">
				<view class="gongneng" >
				<view class="title">
					功能类型
				</view>
				<view class="detail" >
					
					{{ it.bug || it.violation || '功能建议'}}
				</view>
			</view>
			<mylines></mylines>
			<view class="miaosu">
				<view class="title">
					描述
				</view>
				<view class="detail">
					{{it.description}}
				</view>
			</view>
			<mylines></mylines>
			<swiper :indicator-dots="true"  >
				<swiper-item v-for="(ite,inde) in it.photolist" :key="ite.id">
					<view class="swiper-item">
						<image class="swi-img"  :src="ite.url" mode="aspectFit"></image>
					</view>
				</swiper-item>
				
			</swiper>

			
			<view class="huifu">
				<view class="title">
					平台回复
				</view>
				<view  :class="it.backcontent? 'detail' : 'nodetail'">
					{{it.backcontent || '未答复'}}
				</view>
			</view>
			
			</view>
			
		</view>
	</view>
</template>

<script>
	import $http from '@/common/api/request.js'
	import mylines from '@/components/common/Lines.vue'
	export default {
		data() {
			return {
				swiperindex:[],
				listdata:[],
				photolist:[]
			};
		},
		components:{
			mylines
		},
		methods:{
			getmyfeedback(userid){
				
				$http.request({
					url:"/getfeedbackall",
				}).then((res)=>{
					
					 const filteredArray = res.filter(obj =>obj.userid === userid)
					filteredArray.forEach(obj => {
					  obj.photolist = this.clockphotolist(obj)
					});
					  this.listdata.push(filteredArray)
				}).catch(()=>{
					uni.showToast({
						title: "获取失败.",
						icon: "error",
						mask: true,
						duration: 2000
					})
				})
			},
			//getfeedbackproductsuggestion
			getfeedbackproductsuggestion(userid){
				$http.request({
					url:"/getfeedbackproductsuggestion",
				}).then((res)=>{
					const filteredArray = res.filter(obj =>obj.userid === userid)
					filteredArray.forEach(obj => {
					  obj.photolist = this.clockphotolist(obj)
					});
					 
					  this.listdata.push(filteredArray)
				}).catch(()=>{
					uni.showToast({
						title: "获取失败.",
						icon: "error",
						mask: true,
						duration: 2000
					})
				})
			},
			//getfeedbackViolationreporting
			getfeedbackViolationreporting(userid){
				$http.request({
					url:"/getfeedbackViolationreporting",
				}).then((res)=>{
					const filteredArray = res.filter(obj =>obj.userid === userid)
					filteredArray.forEach(obj => {
					  obj.photolist = this.clockphotolist(obj)
					});
					 this.listdata.push(filteredArray)
				}).catch(()=>{
					uni.showToast({
						title: "获取失败.",
						icon: "error",
						mask: true,
						duration: 2000
					})
				})
			},
			clockphotolist(url){
				
			          const photolist=[]
			         photolist.push({id:0,url:url.imgurl1});
			         photolist.push({id:2,url:url.imgurl2});
			         photolist.push({id:3,url:url.imgurl3});
			         photolist.push({id:4,url:url.imgurl4});
					 return photolist.filter(str => str.url.trim() !== "")
			    },
		},
		onLoad(e) {
			this.getmyfeedback(parseInt(e.userid))
			 this.getfeedbackproductsuggestion(parseInt(e.userid))
			 this.getfeedbackViolationreporting(parseInt(e.userid))
			console.log(this.listdata);
		}
		
	}
</script>

<style lang="scss">
	swiper {
		width: 100%;
		height: 350rpx;
		.swi-img{
			width: 100%;
			height: 350rpx;
			
		}
	}
	.allmyfeedback{
		
	}
.gongneng{
	display: flex;
	justify-content: space-around;
	align-items: center;
	padding: 10rpx;

	.detail{
		font-size: 26rpx;
		color: crimson;
	}
}
.miaosu{
	display: flex;
	justify-content: space-around;
	align-items: center;
	padding: 10rpx;

}
.huifu{
	display: flex;
	justify-content: space-around;
	align-items: center;
	padding: 10rpx 0 50rpx 0 ;
	.detail{
		font-size: 30rpx;
		color: green;
	}
	.nodetail{
		font-size: 30rpx;
		color: blue;
	}
}
	.title{
		font-weight: 600;
		font-size: 30rpx;
	
	}
.detail{
		font-size: 26rpx;
		
	}
</style>
